package com.example.mylibrary.base

import android.os.Bundle
import androidx.viewbinding.ViewBinding

abstract class BaseMvpFragment<V : BaseView, P : BasePresenterImpl<V>, B : ViewBinding> :
    BaseFragment<B>() {

    protected var mPresenter: P? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        mPresenter = getPresenter()
        mPresenter?.attachView(this as V)
        super.onCreate(savedInstanceState)
    }

    protected abstract fun getPresenter(): P

    override fun onDestroy() {
        super.onDestroy()
        mPresenter?.detachView()
    }

}